package com.hxd.otc.module.my.presenter;

import android.support.annotation.NonNull;

import com.hxd.otc.base.BaseBean;
import com.hxd.otc.module.my.bean.ApplyRequestBean;
import com.hxd.otc.module.my.contract.VIPServiceContract;
import com.hxd.otc.module.my.model.ApplyModel;
import com.hxd.otc.mvp.base.BasePresenter;
import com.hxd.otc.net.BaseObserver;

/**
 * 包  名 :  com.example.administrator.blocksbankclient.mvp.order
 * 类  名 :  OrderPresenter
 * 作  者 :  zjl
 * 时  间 :  2018/6/4 17:02
 * 描  述 :  ${TODO}所有订单页面P
 */
public class VIPServicePresenter extends BasePresenter<VIPServiceContract.View> implements VIPServiceContract.Presenter {

    private final ApplyModel mApplyModel;

    public VIPServicePresenter(VIPServiceContract.View view) {
        super(view);
        mApplyModel = ApplyModel.getInstance();
    }

    @Override
    public void start() {
    }

    @Override
    public void onSubmit(ApplyRequestBean bean) {
        mApplyModel.apply(bean, new BaseObserver<String>() {
            @Override
            public void onNext(@NonNull String msg, @NonNull String s) {
                mView.onSubmitSuccess();
            }

            @Override
            public void onError(int errType, @NonNull String errMessage) {
                mView.showToast(errMessage);
            }
        }, mView.<BaseBean<String>>bindAutoDispose());
    }
}
